<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<!--引入vue-->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<div id="app">
  <div>
    <h2>我是标题</h2>
    <p>我是内容</p>
  </div>
  <my_cpn></my_cpn>
</div>
<hr>
<div id="app2">
  <cpn></cpn>
</div>
<script>
  const cpnC = Vue.extend({
    template: `<div>
       <h2>我是标题</h2>
       <p>我是内容</p>
        </div>>`
  })

  //注册组件
  //component 使用组件的名字，组件构造器名
  Vue.component('my_cpn', cpnC)
  const app = new Vue({
    el: "#app",
    data: {
      message: "Hello zk I am Vue !"
    },
  })
  const app2 = new Vue({
    el: '#app2',
    //局部注册，只有APP实例用此组件
    components: {
      //定义标签 cpn
      cpn: cpnC
    }
  })
</script>
</body>
</html>
